package com.cmcc.linlaker.utils;

import android.app.Activity;
import android.content.Intent;

import com.cmcc.linlaker.LoginActivity;
import com.cmcc.linlaker.R;
import com.cmcc.linlaker.view.LoginNoticeDialog;

public class IntentUtils {
    public static final String VAILD_CODE = "403";

    public static void skipToLogin(final Activity activity) {
        LoginNoticeDialog dialog = new LoginNoticeDialog(activity, R.style.dialog);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setOnConfirmClickListener(new LoginNoticeDialog.OnConfirmClickListener() {
            @Override
            public void onConfirmClick() {
                Intent intent = new Intent(activity, LoginActivity.class);
                intent.setFlags(intent.FLAG_ACTIVITY_CLEAR_TASK | intent.FLAG_ACTIVITY_NEW_TASK);
                activity.startActivity(intent);
                activity.finish();
            }
        });
        dialog.show();
    }
}